package com.zyit.controller;


import com.zyit.model.Schedule;
import com.zyit.model.SysUsers;
import com.zyit.model.vo.RegisteredInformation;
import com.zyit.service.ScheduleService;
import com.zyit.util.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/schedule")
public class ScheduleController {
    @Resource
    private ScheduleService scheduleService;
    @GetMapping("findByDepartmentAndTime")
    public Result findByDepartmentAndTime(Schedule schedule){
        List<Schedule> byDepartmentAndTime = scheduleService.findByDepartmentAndTime(schedule);
        return new Result(200,byDepartmentAndTime,"");
    }

    @GetMapping("findByUserIdAndSign")
    public Result findByUserIdAndSign(Long userid, Integer sign){
        Schedule schedule = scheduleService.findByUserIdAndSign(userid, sign);
        System.out.println(schedule);
        return new Result(200,schedule,"");
    }

    @GetMapping("findAll")
    public Result findAll(RegisteredInformation ri){
        List<RegisteredInformation> all = scheduleService.findAll(ri);
        return new Result(200,all,"");
    }

}
